#include "QmlSqlWrapper.h"

QmlSqlWrapper::QmlSqlWrapper(QObject *parent)
    : QObject{parent}{
    sqlPtr = AnalysisSql::instance();
}

QVariantList QmlSqlWrapper::getPatientList(){
    QVector<SqlDomain::AnalysisDomain> queryDataList = sqlPtr->queryDataList();
    QVariantList mapList;

    for(SqlDomain::AnalysisDomain &e : queryDataList){
        QVariantMap eMap;

        eMap["testId"] = e.testId;
        eMap["patientName"] = e.patientName;
        mapList.append(eMap);
    }

    return mapList;
}

QVariantList QmlSqlWrapper::getDealList(QString name, QString testId){
    QVector<SqlDomain::AnalysisDomain> dealDateList = sqlPtr->queryDealList(name, testId);

    QVariantList mapList;
    for(SqlDomain::AnalysisDomain &e : dealDateList){
        QVariantMap eMap;

        eMap["patientName"] = e.patientName;
        eMap["testId"] = e.testId;
        eMap["imageName"] = e.imageName;
        eMap["taskStatus"] = e.taskStatus;
        eMap["errMsg"] = e.errMsg;

        mapList.append(eMap);
    }

    return mapList;
}
